const Koa = require('koa');
const router = require('koa-router')();
const app = new Koa();

const path = require('path')
const static = require('koa-static')

const subject = require('./data/category/class_category.js')

const details = require('./data/category/class_details.js')
const login = require('./data/category/logindata.js')

const home = require('./data/home/home.js')
const recommend = require('./data/home/recommend.js')
const correlation = require('./data/home/correlation.js')
const catalog = require('./data/home/catalog.js')
const viewdata = require('./data/home/viewdata.js')
const hotbang = require('./data/home/hotbang.js')



//引入图片
const publicimg = './imgpublic'

app.use(static(
	path.join(__dirname,publicimg)
))
//subject
router.get('/subject',async (ctx,next) => {
	ctx.body = subject
})

//details
router.get('/details',async (ctx,next) => {
	ctx.body = details
})
// login 
router.get('/login',async (ctx,next) => {
	ctx.body = login
})

router.get('/home',async (ctx,next) => {
	ctx.body = home
})
router.get('/recommend',async (ctx,next) => {
	ctx.body = recommend
})
router.get('/correlation',async (ctx,next) => {
	ctx.body = correlation
})
router.get('/catalog',async (ctx,next) => {
	ctx.body = catalog

})
router.get('/viewdata',async (ctx,next) => {
	ctx.body = viewdata
})
router.get('/hotbang',async (ctx,next) => {
	ctx.body = hotbang
})


app.use(router.routes());

app.listen(3000,function(){
	console.log(3000)
});